<template>
    <div class="oa-container container">
        <div class="tabs-box">
            <MyTabs :list="tabslist" :active="tabsActive" @activechange="tabsChanged"></MyTabs>
        </div>
        <transition :name="oaTransition">
            <keep-alive>
                <component :is="current"></component>
            </keep-alive>
        </transition>
        <Footer :active="3"></Footer>
    </div>
</template>
<script>
import MyTabs from '@/components/mytabs';
import Footer from '@/components/footer';
import OrderList from './orderlist';
import Department from './department';
import Contract from './contract';
import Chart from './chart';
export default {
    name: 'OA',
    components:{
        MyTabs,
        Footer,
        OrderList,
        Department,
        Contract,
        Chart
    },
    data() {
        return {
            tabslist:['流程','部门管理','合同','报表'],
            tabsComponent:['OrderList','Department','Contract','Chart'],
            tabsActive:0,
            keyword:'',
            current:'OrderList',
            oaTransition:''
        }
    },
    methods:{
        tabsChanged(index) {
            
            if(index > this.tabsActive) {
                this.oaTransition = 'slide-rightin-leftout';
            } else {
                this.oaTransition = 'slide-leftin-rightout';
            }
            let name = this.tabsComponent[index];
            this.$nextTick(()=>{
                this.tabsActive = index;
                this.current = name;
            })
        },
    }
}
</script>
<style lang="less">
.oa-container {
    .tabs-box {
        width: 100%;
        background:#fff;
        position: fixed;
        z-index: 1;
    }
}
</style>